package com.lswms.modules.lswms.dao.base;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.lswms.common.dao.BaseDao;
import com.lswms.modules.lswms.entity.base.SkuEntity;
import com.lswms.modules.lswms.entity.orders.OrdersEntity;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ${comments}
 *
 * @author DX sunlightcs@gmail.com
 * @since 1.0.0 2021-06-06
 */
@Mapper
public interface SkuDao extends BaseDao<SkuEntity> {

	
    @Select("select sku from [dbo].[lswms_sku]")
    List<String> getSkuList();
    
    
    @Select(value ="select lswms_sku.*   ,lswms_skucategory.name categoryname,a.listname isconsumablestr ,b.listname isuniquecodestr,c.listname rolatebystr,\r\n"
    		+ "	lswms_putawaystrategy.strategyname strategyname ,lswms_allocationstrategy.strategyname allocationstrategyname,lswms_zone.zonename zonename\r\n"
    		+ "	from lswms_sku left join lswms_skucategory  on lswms_sku.sort = lswms_skucategory.categorykey\r\n"
    		+ "			left join  lswms_codelist a on  lswms_sku.isconsumable = a.list and a.code='YESORNO' \r\n"
    		+ "			left join  lswms_codelist b on lswms_sku.isuniquecode = b.list and b.code='YESORNO'  \r\n"
    		+ "			left join  lswms_codelist c on  lswms_sku.rolateby = c.list and c.code='rolateby' \r\n"
    		+ "			left join  lswms_putawaystrategy  on lswms_sku.strategykey = lswms_putawaystrategy.strategykey\r\n"
    		+ "			left join  lswms_allocationstrategy on lswms_sku.allocationstrategy = lswms_allocationstrategy.strategykey\r\n"
    		+ "			left join  lswms_zone on lswms_sku.zonecode = lswms_zone.zonecode  ${ew.customSqlSegment}")
	IPage<SkuEntity> selectPageBySql(IPage<SkuEntity> page, @Param(Constants.WRAPPER) QueryWrapper<SkuEntity> wrapper);
}
